package test;

import javax.swing.*;
import java.awt.*;

public class App {

    private static class CheckRenderer implements ListCellRenderer {

        private JCheckBox chk;

        public CheckRenderer() {
            chk = new JCheckBox("hello");
            chk.setOpaque(false);
            chk.setBackground(Color.blue);
        }

        @Override
        public Component getListCellRendererComponent(JList list, Object value,
                int index, boolean isSelected, boolean cellHasFocus) {

            return chk;
        }
    }

    public static void main(String[] args) {
        JFrame frame = new JFrame();
        JPanel container = new JPanel();
        container.setBackground(Color.yellow);
        frame.getContentPane().add(container);

        JList lst = new JList(new String[]{"one", "two", "three"});
        lst.setOpaque(false);
        lst.setBackground(Color.green);
        lst.setCellRenderer(new CheckRenderer());
        lst.setPreferredSize(new Dimension(100, 150));
        lst.setBorder(BorderFactory.createLineBorder(Color.black));
        container.add(lst);

        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setSize(320, 240);
        frame.setVisible(true);
    }
}
